package me.feng.component
{
	import flash.display.Sprite;

	import me.feng.debug.assert;
	import me.feng.events.FErrorEvent;

	/**
	 *
	 * @author feng 2015-12-7
	 */
	public class UniqueNameComponentTester extends Sprite
	{

		[Test]
		public function testUniqueName():void
		{
			var component:Component = new Component();
			var uniqueNameComponent:UniqueNameComponent = new UniqueNameComponent();
			component.addComponent(uniqueNameComponent);

			var componentA:Component = new Component();
			componentA.componentName = "comA";
			component.addComponent(componentA);

			var throwError:Boolean = false;
			uniqueNameComponent.addEventListener(FErrorEvent.ERROR_EVENT, function(event:FErrorEvent):void
			{
				event.isProcessed = true;
				throwError = true;
			});
			var componentB:Component = new Component();
			componentB.componentName = "comA";
			component.addComponent(componentB);
			assert(throwError);
		}

	}
}
